package cn.redsoft.tools.util;

import java.text.SimpleDateFormat;
import java.util.Date;

public class DateUtils {
	public static final String time = "HH:mm:ss";
	public static final String time_no_separator = "HHmmss";
	public static final String date_time = "yyyy-MM-dd HH:mm:ss";
	public static final String date_time_no_separator = "yyyyMMddHHmmss";
	public static final String timestamp = "yyyy-MM-dd HH:mm:ss:sss";
	public static final String timestamp_no_separator = "yyyyMMddHHmmsssss";

	public static String date2String(Date date, String pattern) {
		return new SimpleDateFormat(pattern).format(date);
	}

	public static String date2String(Date date) {
		return new SimpleDateFormat(date_time).format(date);
	}
}
